package com.google.denta.service;

import java.util.List;

import com.google.denta.entity.Group;
import com.google.denta.entity.User;

/**
 * @author Aliaksei_Kuliashou
 */
public interface GroupService {
    /**
     * Get all groups.
     * @return list of all groups.
     */
    List<Group> getGroups();

    /**
     * Get group by id.
     * @param id - id of group.
     * @return group.
     */
    Group getGroup(Long id);

    /**
     * Get all users list by id of group.
     * @param id - group id
     * @param flag - return group's (true) or non-group's (false) users
     * @return Group's users list
     */
    List<User> getUsers(Long id, Boolean flag);

    /**
     * Get group by name.
     * @param name - name of group
     * @return Group
     */
    Group getGroupByName(String name);

    /**
     * Delete group by id.
     * @param id - id of deleted group.
     */
    void deleteGroup(Long id);

    /**
     * Delete groups by their ids.
     * @param ids - id's of groups.
     */
    void deleteGroups(Long[] ids);

    /**
     * Delete all group users.
     * @param gid - group id
     */
    void deleteUsers(Long gid);

    /**
     * Delete group users by their ids.
     * @param gid - group id
     * @param ids - array of group users ids
     */
    void deleteUsers(Long gid, Long[] ids);

    /**
     * Add to group users by their ids.
     * @param gid - group id
     * @param uids - array of users ids
     */
    void addUsers(Long gid, Long[] uids);

    /**
     * Create or save group.
     * @param group - group to save or create.
     */
    void saveGroup(Group group);

    /**
     * Save roles of group.
     * @param group - group to save.
     */
    void saveGroupRoles(Group group);
}
